package com.cn.consumer;

import com.cn.constant.TopicConst;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

/**
 * 类的功能描述：
 * 消息消费者者用于处理消息
 */
@Service
public class MessageConsumer
{
    private final Logger logger = LoggerFactory.getLogger(MessageConsumer.class);

    @KafkaListener(topics = TopicConst.PAY_TOPIC)
    public void onMessage(ConsumerRecord<?, ?> record)
    {
        logger.info("消费者接收到消息为:" + record.topic() + "-" + record.partition() + "-" + record.value());
    }
}